<?php session_start();
error_reporting (E_ALL & ~E_NOTICE | E_STRICT );
if($_SESSION["usuario"] == ""){
echo"Acceso Denegado a este sitio.... usted no tiene privilegios";
}
else{
?>
<html>
    <head>
        <title>anehs</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"/>
              <!--css menu-->
			<link href="../menubox/css/stylepanel.css" rel="stylesheet" type="text/css"/>
	<link href="css/style.css" rel="stylesheet" type="text/css"/>
	<link href="css/table.css" rel="stylesheet" type="text/css"/>
         <style>
			body{
				background:#333 url(../images/MU.jpg) no-repeat center center fixed;
				-webkit-background-size: cover;
				-moz-background-size: cover;
				-o-background-size: cover;
				background-size: cover;
				font-family:Arial;
			}
			
			
		</style>
		
		
</head>

<body>
<br>
<center>

		
			<div class="content">
			
				
				
				<a href="PanelAdministrador.php">
						
							<span class="sdt_link"><h2><font color="white">Panel Administrador</font></h2></span>
											
				  </a>
				 
			</center>
		<span class="reference">
		</span>
		        <div>
            
               
            


<!-- The JavaScript -->
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
		<script type="text/javascript" src="../menubox/jquery.easing.1.3.js"></script>
        <script type="text/javascript">
            $(function() {
				/**
				* for each menu element, on mouseenter, 
				* we enlarge the image, and show both sdt_active span and 
				* sdt_wrap span. If the element has a sub menu (sdt_box),
				* then we slide it - if the element is the last one in the menu
				* we slide it to the left, otherwise to the right
				*/
                $('#sdt_menu > li').bind('mouseenter',function(){
					var $elem = $(this);
					$elem.find('img')
						 .stop(true)
						 .animate({
							'width':'170px',
							'height':'170px',
							'left':'0px'
						 },400,'easeOutBack')
						 .andSelf()
						 .find('.sdt_wrap')
					     .stop(true)
						 .animate({'top':'140px'},500,'easeOutBack')
						 .andSelf()
						 .find('.sdt_active')
					     .stop(true)
						 .animate({'height':'170px'},300,function(){
						var $sub_menu = $elem.find('.sdt_box');
						if($sub_menu.length){
							var left = '170px';
							if($elem.parent().children().length == $elem.index()+1)
								left = '-170px';
							$sub_menu.show().animate({'left':left},200);
						}	
					});
				}).bind('mouseleave',function(){
					var $elem = $(this);
					var $sub_menu = $elem.find('.sdt_box');
					if($sub_menu.length)
						$sub_menu.hide().css('left','0px');
					
					$elem.find('.sdt_active')
						 .stop(true)
						 .animate({'height':'0px'},300)
						 .andSelf().find('img')
						 .stop(true)
						 .animate({
							'width':'0px',
							'height':'0px',
							'left':'85px'},400)
						 .andSelf()
						 .find('.sdt_wrap')
						 .stop(true)
						 .animate({'top':'25px'},500);
				});
            });
        </script>


<!-- Page START -->
</div>
  
<div >
  <h1 class="Estilo1">&nbsp;         </h1>
  <h1 class="Estilo1">&nbsp;</h1>
  <center><h3><font color="white">Registro de usuarios </h3></center>
  <p>
    <?php
				include_once("entidades/cConexion.php");
				$con=new cConexion();
				if($_GET["idU"]!=""){
					$con->conectar();
					$tabla =$con ->ejecutar("select * from usuario where idU= ".$_GET["idU"]);
					$fila= mysql_fetch_array($tabla);
					$con->desconectar();
				}
				?>
  </p>
  <p>&nbsp; </p>
  <center>
 
<form action="controlador/controladorRegistro.php" method="post" name="Categoria" id="frm" border: none;>
  <fieldset name="datos">
  <div class="field"><label><span class="Estilo10">Nombre:</span></label>
  <input type="text" name="nombre"  value="<?php echo $fila["nombre"] ?>" placeholder="Ingresa el nombre de Usiario" required autofocus style="width: 250px"/></div>
  <div class="field"><label><span class="Estilo10">Contraseña:</span></label>
   <input type="text" name="contrasenia"  value="<?php echo $fila["contrasenia"] ?>" placeholder="Ingresa el la contraseña " required autofocus style="width: 250px"/></div>
   <div class="field"><label><span class="Estilo10">Nivel:</span></label>
   <select name="slnivel">
							<option><?php echo $fila["nivel"] ?>
							<option>--selecciona--</option>
							<option>usuario</option>
							<option>administrador</option>
						</select>
   </label>
  <input type="hidden" name="id" value="<?php echo $fila["idU"] ?>" placeholder="ID" />
 
  <label id="lblNombre" value="NOMBRE: "/>    
  </label>
  </span>
  </fieldset>
  <fieldset id="acciones" name="acciones">
  <?php
						if(isset($_GET['idU'])){
						?>
  <input type="hidden" value="3" name="ope"/>
  <input name="submit" type="submit" id="btnModificar" value="Modificar"/>
  <?php
						}
						else{
						
						
						?>
  <input type="hidden" value="1" name="ope"/>
  <input name="submit" type="submit" id="btnInsertar" value="Insertar"/>
  <input name="submit" type="submit" id="btnCancelar" value="Cancelar"/>
  <?php
							}
							?>
  </fieldset>
  <p>&nbsp; </p>
  <?php

include_once("entidades/cRegistro.php");
$usu=new cRegistro(NULL);
$tabla=$usu->listar("select * from usuario");

		echo "<table id=borders><tr><th id=dose>Nombre</th><th id=dose>Contraseña</th><th id=dose>Nivel</th><th id=dose>Eliminar</th><th id=dose>Modificar</th></tr>";
		foreach($tabla as $fila){
		echo "<tr>";
		echo "<td id=unos>".($fila->getNombre()). "</td>";
		echo "<td id=unos>".($fila->getContrasenia()). "</td>";
		echo "<td id=unos>".($fila->getNivel()). "</td>";
		echo "<td id=unos>";
		echo "<a href='controlador/controladorRegistro.php?idU=".$fila->getIdU()."&ope=2'><img src=images/delete.png></a></td>";
		echo "<td id=unos> <a href='Usuarios.php?idU=".$fila->getIdU()."&ope=3'><img src=images/editar.png></a></td>";
		echo "</tr>";
		}
		echo "</table>";
		?>
</form>
</center>
</div>


<!-- Page END -->

</body>
</html>
<?php
}
?>